home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 June: Reference Library / Dev.CD Jun 94.toast / Periodicals / develop / develop Issue 15 / develop 15 code / Floating Windows / Sample / Source / fileMenuRoutines.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-14  |  1.1 KB  |  65 lines  |  [TEXT/MPS ]

  1. #include <Types.h>
  2. #include <Dialogs.h>
  3. #include <StandardFile.h>
  4. #include <TextUtils.h>
  5.  
  6. #include "fileMenuRoutines.h"
  7. #include "WindowExtensions.h"
  8.  
  9.     /* Temporary defines */
  10.     
  11. #define    rAlertStringsID    129
  12. #define    kOpenFileString    1
  13. #define    kPrintFileString    2
  14.  
  15.     /*    Private prototypes */
  16.     
  17. void    AlertUser(short alertStringID, Str255 fileName);
  18.     
  19. void    AlertUser(short    alertStringID, Str255 fileName)
  20. {
  21.     short    alrtItem;
  22.     Str255    errString;
  23.     
  24.     GetIndString(&errString, rAlertStringsID, alertStringID);
  25.     ParamText(errString, fileName, nil, nil);
  26.     alrtItem = Alert(129, nil);
  27. }
  28.  
  29. void    GetFileToOpen()
  30.  
  31. /*    Have user choose a file to open from StandardGetFile */
  32.  
  33. {
  34.     StandardFileReply    fileInfo;
  35.     SFTypeList            typesToShow;
  36.     
  37.     typesToShow[0] = '****';
  38.     
  39.     DeactivateFloatersAndFirstDocumentWindow();
  40.     StandardGetFile(nil, -1, typesToShow, &fileInfo);
  41.     
  42.     if (fileInfo.sfGood)
  43.         DoOpenFile(&(fileInfo.sfFile));
  44.     
  45.     ActivateFloatersAndFirstDocumentWindow();
  46. }
  47.  
  48. void    DoOpenFile(FSSpec *fileToOpen)
  49.  
  50. {
  51.     AlertUser(kOpenFileString, fileToOpen->name);
  52. }
  53.  
  54. void    DoPrint()
  55.  
  56. {
  57. }
  58.  
  59. void    DoPrintFile(FSSpec *fileToPrint)
  60.  
  61. {
  62.     AlertUser(kPrintFileString, fileToPrint->name);
  63. }
  64.  
  65.